<template>
  <el-table :data="data.positionList" border class="tabledata" :cellStyle="cellStyle">
    <el-table-column prop="id" sortable label="序号" width="100px" />
    <el-table-column prop="name" sortable label="岗位名称" />
    <el-table-column prop="category" sortable label="岗位类别" />
    <el-table-column prop="description" sortable label="岗位描述" />
    <el-table-column prop="address" sortable label="所在城市" />
    <el-table-column prop="minSalary" sortable label="最低薪资" />
    <el-table-column prop="maxSalary" sortable label="最高薪资" />
    <el-table-column prop="workExperience" sortable label="工作经验" />
    <el-table-column prop="company" sortable label="公司名称" />
  </el-table>
</template>
<script setup>
import router from "@/router";
import { reactive, ref } from "vue";
import { ElMessage } from 'element-plus'
import { getPositions } from "../../utils/request";
const data = reactive({
  pageSize: 10,
  pageNumber: 1,
  positionList: [],
})

// 表格字段为空操作
const cellStyle= ({ row, column, rowIndex, columnIndex })=> {
  if (row[column.property] == null) {
    row[column.property] = '--'
  }
}
const positionInfoVisible = ref(false)
getPositions(data).then(res => {
  if (res.data.code != 200) {
    ElMessage.error(res.data.message || '请求失败')
  } else {
    data.positionList = res.data.data
  }
})

</script>
<style>
.tabledata {
  width: 100%;
}

.el-table__row,
.el-table__cell {
  height: 60px;
}
</style>
